package com.nuonuo.dubbo.auth.controller;

import com.nuonuo.dubbo.auth.api.DubboAuthService;
import com.nuonuo.dubbo.auth.api.DubboTlsService;
import com.nuonuo.dubbo.auth.api.DubboTokenService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author duan
 * @version 1.0
 * @date 2023/2/23 14:32
 */
@RestController
@RequestMapping(value = "/auth")
public class AuthController {

    @DubboReference(version = "1.0.0", timeout = 10000, parameters = {".accessKeyId", "www", ".secretAccessKey", "bbbb"})
    private DubboAuthService dubboAuthService;

    @DubboReference(version = "1.0.0")
    private DubboTokenService dubboTokenService;

    @DubboReference(version = "1.0.0")
    private DubboTlsService dubboTlsService;

    @GetMapping(value = "sayHello")
    public String sayHello() {
        return dubboAuthService.sayHello();
    }

    @GetMapping(value = "getTimestamp")
    public String getTimestamp() {
        return dubboTokenService.getTimeStamp();
    }

    @GetMapping(value = "sayJava")
    public String sayJava() {
        return dubboTlsService.sayJava();
    }
}
